package kr.hkit.powerjava.chapter09;
//203페이지 예제3

class Point {
	private int x;
	private int y;
	
	public Point(int x, int y) {
		this.x = x;
		this.y = y;
		
		
	}

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}

	@Override
	public String toString() {
		return "Point [x=" + x + ", y=" + y + "]";
	}

}


class Circle {
	
	public static final double PI = 3.14; //상수. 수정불가
	//다른패키지 같은 패키지에서도 참조가능. 일관성유지됨
	
	private int radius = 0;
	private Point center;
	
/*	public Circle(Point p, int r) {
		center = p;
		radius = r;
	}
*/
	public Circle(int radius, Point center) {
		this.radius = radius;
		this.center = center;
	}
	

	public int getRadius() {
		return radius;
	}


	public void setRadius(int radius) {
		this.radius = radius;
	}


	public Point getCenter() {
		return center;
	}


	public void setCenter(Point center) {
		this.center = center;
	}


	@Override
	public String toString() {
		return "Circle [radius=" + radius + ", center=" + center + "]";
	}
}


public class CircleTest { 
	public static void main(String[] args) {
		
		Point p = new Point(25, 78);
		Circle c= new Circle(10, p);
		System.out.println(c);
		
		//방법1
		/*p.setX(50);
		p.setY(100);
		c.setRadius(15);
		System.out.println(c);*/
		
		//방법2
		Point p1 = c.getCenter(); 
		p1.setX(100);
		p1.setY(200);
		c.setRadius(15);
		System.out.println(c);
		
	/*	Math m = new Math();
		m.sqrt(100); //정적 메소드를 몰랐을 때. 
		이건 굳이 생성할 필요 없음*/
		
		System.out.println("Math.sqrt(100): "+Math.sqrt(100)); //루트입니다.
		//Math 메소드는 객체 생성하지 않고 (인스턴스화 하지않고) 바로 쓸 수 있음
		
		
	}
}
